home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / RAND / UNSPLIT / text0559.txt < prev    next >
Encoding:
Text File  |  1997-02-06  |  3.0 KB  |  79 lines

  1. On my request to help out to code I got thid reply from Magnus Kollberg:
  2.  
  3. <Well, I don't know what you code, but there is still some bits missing. I don't
  4. <know if they are 'small' though. :-)
  5.  
  6. <The most important is the sound I think and we will also need some kind of
  7. <collision detection when you shot at monsters and when they fire back. I'm
  8. <not sure if this is a part of Fabrice work, but I don't think so.
  9.  
  10. The sound as I understand this must be the ingame-sound-fx. And yes, that I 
  11. could code. I have thougth about it today (While working hard!!!) and come 
  12. up with this solution:
  13.  
  14. Maximum of 4 or 8 mixed sounds. (Selecteble while playingprefably) Each of 
  15. theese "channels" have one of theese tables:
  16.         ds.l    1       ; address to start of sample
  17.         ds.l    1       ; length of sample
  18.         ds.l    1       ; current pos in sample
  19.         ds.w    2       ; X and Y position of source of sound
  20.         ds.b    1       ; Priority of sound
  21.         even
  22. If the game engine wants to play a sound then give this info to in registers 
  23. or in some table and call a subroutine wich will do like this:  (Sorry I 
  24. know you like C)
  25. procedure(sound);
  26. begin
  27.   if antsounds<maxantsounds then
  28.    begin
  29.     inc(antsounds);
  30.     soundtable[antsounds]:=sound;
  31.    end;
  32.   else
  33.    begin
  34.     c:=0;
  35.     repeat
  36.       inc(c);
  37.     while(c<=maxsamples and sound.prior<soundtable[c].prior);
  38.     if c<=maxsamples then soundtable[c]:=sound;
  39.    end;
  40. end;
  41. That means first check if all channels are used, if not then just ocupy one 
  42. for this sound, if they are then check if one of the sounds currently played 
  43. have lower priority then the new one, if there is one then take over that 
  44. channel, if all old sounds have higher priority then tough luck: this sound 
  45. wont be payed!!!
  46.  
  47. And now to the actual replay:
  48. Original, doom sound fx are sampled with ~11khz, Atari would love to replay 
  49. those at 12.25kHz. Now some processor time will be lost by correcting to the 
  50. right speed, but I do not personaly think we will need to. I have tested a 
  51. few samples and the differenses are barely noticable...   And original Bad 
  52. Mood IWADs will be sampled at 12.25kHz, wont they?!?
  53. The second time loss/winning is having inerleaved replayed...  Lets show 
  54. what I mean. A comma separates the sample bytes (stereo not shown).
  55. A+B,C+D,A+B,C+D,A+...   (Interleaved)
  56. A+B+C+D,A+B+C+D,A+...   (Non interleaved)
  57. I do not know if interleaved will sound terible for 12.kHz or not... But if 
  58. not then the time winning would be good.
  59.  
  60. The replay code will land on nearly 200k of RAM, if I can cood it as I want 
  61. to... This includes some tables for 3D sound and such, but I think I could 
  62. get it very fast with some effort put into it. And that I will do!
  63.  
  64. Before I begin, I want to know how you want the interface for adding new 
  65. sounds to be played, and inprovements, tips, and most important if someone 
  66. already have started on theese routines...
  67.  
  68. Till then code calm...
  69.  
  70. mvh
  71.         PeyloW of T.O.Y.S.
  72.  
  73. PS! By the way, the less sound currently played, the less processor time it 
  74. will take ofcourse! :-)
  75.  
  76.  
  77.  
  78.  
  79.